package com.sample.plove.api.v1;

import com.sample.plove.database.model.AccessTokenEntity;
import com.sample.plove.database.service.AccessToeknServer;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;

import java.util.Map;

/**
 * PackageName:com.sample.plove.controll.api.v1
 * Author:Administrator
 * Time:1:26
 * Date:2019/5/16
 * Describe:
 */
@Controller
@Slf4j
public class TestControll {
    @Autowired
    private AccessToeknServer accessToeknServer;



    @RequestMapping(value = "/test",method = RequestMethod.GET)
    public String test(){
        return "HelloWorld";
    }

    @RequestMapping(value = "accessToken",method = RequestMethod.GET)
    public String addAccessToken(AccessTokenEntity entity) {
        entity.setId(123456);
        entity.setExpiresIn(7200);
        entity.setCreateDate("2019-05-18");
        entity.setAccessToken("123qweasd");
        accessToeknServer.updateAccessToken(entity);
        return entity.toString();
    }

}
